<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/auth/templates/template.xhtml">
	<ui:define name="pageTitle">Estorno de Item de Venda</ui:define>
	<ui:define name="body">
		<f:view>

			<f:metadata>
				<f:viewParam name="itemVenda"
					value="#{vendaVSBean.itemVendaSelecionado}" />
			</f:metadata>

			<p:growl id="messages" autoUpdate="true" closable="true" />

			<h:form id="form">

				<h:panelGrid cellspacing="10px" styleClass="center">
					<f:facet name="header">Estorno de Item de Venda</f:facet>

					<p:focus context="form" />

					<h:panelGrid columns="2" cellspacing="10px">

						<h:outputText value="Item Venda Nº" />
						<h:outputText
							value="#{vendaVSBean.itemVendaSelecionado.idItemVenda}" />
						<h:outputText value="Quantidade do Item de Venda" />
						<h:outputText
							value="#{vendaVSBean.itemVendaSelecionado.itemPedidoVenda.quantidade}" />

						<p:outputLabel value="Quantidade" for="txtQuantidade" />
						<p:inputText id="txtQuantidade"
							value="#{vendaVSBean.quantidadeEstorno}" required="true">
							<f:validateLongRange minimum="0" />
						</p:inputText>
						<p:outputLabel value="Incluir Perda em Estoque" for="improprio" />
						<p:selectBooleanCheckbox id="improprio"
							value="#{vendaVSBean.estornoItemEstoqueImproprio}"
							required="true" />
					</h:panelGrid>
					<p:commandButton update="@form" value="Enviar"
						action="#{vendaVSBean.estornarVenda()}" title="Estornar">
					</p:commandButton>
				</h:panelGrid>

			</h:form>

		</f:view>
	</ui:define>
</ui:composition>

</html>